﻿Namespace Log
    Public Class Provider
        Private Shared mProvider As ILogProvider

        Private Sub New()
        End Sub

        Public Shared Sub RegisterProvider(ByVal provider As ILogProvider)
            mProvider = provider
        End Sub

        Public Shared Sub LogInformation(ByVal text As String)
            If mProvider IsNot Nothing Then mProvider.LogInformation(text)
        End Sub
        Public Shared Sub LogWarning(ByVal text As String)
            If mProvider IsNot Nothing Then mProvider.LogWarning(text)
        End Sub
        Public Shared Sub LogError(ByVal text As String)
            If mProvider IsNot Nothing Then mProvider.LogError(text)
        End Sub
        Public Shared Sub LogError(ByVal text As String, ByVal exception As Exception)
            If mProvider IsNot Nothing Then mProvider.LogError(text, exception)
        End Sub
    End Class

    Public Interface ILogProvider
        Sub LogInformation(ByVal text As String)
        Sub LogWarning(ByVal text As String)
        Sub LogError(ByVal text As String)
        Sub LogError(ByVal text As String, ByVal exception As Exception)
    End Interface
End Namespace